﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using XuanXiang.Infrastructure.Attr;
using XuanXiang.Infrastructure.Dto.Request;
using XuanXiang.Infrastructure.Dto.Request.Merchant;
using XuanXiang.Infrastructure.Dto.Response.Promote;
using XuanXiang.Service.Interface;

namespace XuanXiang.Api.Admin.Controllers
{

    [ApiGroup("Admin(管理员模块)")]
    public class OrdersController : BaseController
    {
        private readonly I_Orders_Service _orders_Service;

        public OrdersController(I_Login_Service login_Service,I_Orders_Service orders_Service
            ) : base(login_Service)
        {
            _orders_Service = orders_Service;
        }


        /// <summary>
        /// 获取订单列表{page,limit,key}
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Orders(int page = 1, int limit = 10, string? key = "")
        {
            var result = await _orders_Service.Get_Orders(new Fenye_Dto() { 
            page=page,
            limit=limit,
            key=key??"",
          
            });

            return Ok(result);
        }


        /// <summary>
        /// 获取订单的商品详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Orders_Goods_Details(string? id) {
            var result =await _orders_Service.Get_Orders_Goods_Details(id);
            return Ok(result);
        }
    }
}
